<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.List"%>
<%@ page import="activity.Activity"%>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="javax.jdo.Query" %>
<%@ page import="activity.PMF" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>上架總覽</title>
</head>
<body>

<table border="1">
<%
PersistenceManager pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(Activity.class);
//query.setFilter("inventory >= reorderPoint"); //DOES NOT WORK
//query.setOrdering("hireDate desc");
//query.declareParameters("String lastNameParam");

try {
    List<Activity> results = (List<Activity>) query.execute();

%>
<tr><td>商家名稱</td><td>活動名稱</td><td>集點起始日</td><td>集點截止日</td><td>兌換起始日</td><td>兌換截止日</td><td>描述</td></tr>
<%
        for (Activity act : results) {
        	
%>
				
				<tr>
				<td><%=act.getActShop() %></td>			
				<td><%=act.getActName() %></td>
				<td><%=act.getActStart() %></td>
				<td><%=act.getActEnd() %></td>
				<td><%=act.getActStartChan() %></td>
				<td><%=act.getActEndChan() %></td>				
				<td><%=act.getActContent()%></td>
				</tr>
<% 
        	
        }	
		
    		
}//try
finally {
    query.closeAll();
}

%>

</table>
<a href="Activity.jsp">回上頁</a>
</body>
</html>